package lab1;

public class Computer extends pc {
	public String name;
	public cpu cpu;
	public memory memory;
	public harddrive harddrive;
	public motherboard motherboard;
	public double totalprice;

	public Computer(String name, cpu cpu, memory memory, harddrive harddrive, motherboard motherboard) {
		this.name = name;
		this.cpu = cpu;
		this.memory = memory;
		this.harddrive = harddrive;
		this.motherboard = motherboard;
		totalprice = cpu.getprice() + memory.getprice() + harddrive.getprice() + motherboard.getprice();
	}

	public void view() {
		System.out.println("Computer: " + name);
		System.out.println("cpu: " + cpu.getname() + " core: " + cpu.getcorenum() + " price: " + cpu.getprice());
		System.out.println(
				"memory: " + memory.getname() + " volume: " + memory.getvolume() + " price: " + memory.getprice());
		System.out.println("hard drive: " + harddrive.getname() + " volume: " + harddrive.getvolume() + " price: "
				+ harddrive.getprice());
		System.out.println("motherboard: " + motherboard.getname() + " speed: " + motherboard.getspeed() + " price: "
				+ motherboard.getprice());
		System.out.println("Total pirce: " + totalprice);
	}
}
